package springboot.demo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import springboot.demo.constant.UserConstant;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 用户数据传输对象
 */
@Data
@Schema(description = "用户注册请求对象")
public class UserDto {
    
    /**
     * 用户ID
     */
    @Schema(description = "用户ID", example = "1")
    private Integer id;
    
    /**
     * 登录名
     */
    @Schema(description = "登录名", example = "testuser", required = true)
    @NotBlank(message = UserConstant.ErrorMessage.LOGINNAME_EMPTY)
    @Size(min = UserConstant.LoginName.MIN_LENGTH, max = UserConstant.LoginName.MAX_LENGTH, 
          message = UserConstant.ErrorMessage.LOGINNAME_LENGTH)
    private String loginname;
    
    /**
     * 密码
     */
    @Schema(description = "密码", example = "123456", required = true)
    @NotBlank(message = UserConstant.ErrorMessage.PASSWORD_EMPTY)
    @Size(min = UserConstant.Password.MIN_LENGTH, max = UserConstant.Password.MAX_LENGTH, 
          message = UserConstant.ErrorMessage.PASSWORD_LENGTH)
    private String password;
    
    /**
     * 真实姓名
     */
    @Schema(description = "真实姓名", example = "张三", required = true)
    @NotBlank(message = UserConstant.ErrorMessage.REALNAME_EMPTY)
    private String realname;
    
    /**
     * 用户类型
     */
    @Schema(description = "用户类型", example = UserConstant.UserType.USER)
    private String type;
    
    /**
     * 版本号
     */
    @Schema(description = "版本号", example = "1")
    private Integer ver;
} 